var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0}), (o.eases = void 0);
var n = (function () {
    function t() {
        this.s = new Array();
    }
    return (
        (t.prototype.from = function (t, e, o, n, r, a, i) {
            this.add(t, e, null, e, o, n, r, a, i);
        }),
        (t.prototype.to = function (t, e, o, n, r, a, i) {
            this.add(t, null, e, null, o, n, r, a, i);
        }),
        (t.prototype.fromTo = function (t, e, o, n, r, a, i, s) {
            this.add(t, e, o, e, n, r, a, i, s);
        }),
        (t.prototype.add = function (t, e, o, n, r, i, s, c, l) {
            this.s.push(new a(t, e, o, n, r, i, s, c, l));
        }),
        (t.prototype.clear = function (t) {
            for (var e = -1, o = 0, n = this.s; o < n.length; o++) {
                var r = n[o];
                e++, r && r.target == t && (r.clear(), (this.s[e] = null));
            }
        }),
        (t.prototype.clearAll = function () {
            for (var t = 0, e = this.s; t < e.length; t++) {
                var o = e[t];
                o && o.clear();
            }
            this.s.length = 0;
        }),
        (t.prototype.step = function (t) {
            for (var e = -1, o = 0, n = this.s; o < n.length; o++) {
                e++, (r = n[o]) && r.step(t) && (r.clear(), (this.s[e] = null));
            }
            for (e = this.s.length; e--; ) {
                var r;
                (r = this.s[e]) || this.s.splice(e, 1);
            }
        }),
        t
    );
})();
o.default = n;
var r,
    a = (function () {
        function t(t, e, o, n, a, i, s, c, l) {
            if (t) {
                if (
                    ((this.target = t),
                    (this.fromProps = e),
                    (this.toProps = o),
                    (this.duration = a),
                    (this.ease = i),
                    (this.complete = s),
                    (this.update = c),
                    (this.delay = l),
                    this.fromProps)
                );
                else for (var u in ((this.fromProps = {}), this.toProps)) this.fromProps[u] = this.target[u];
                if (this.toProps);
                else for (var u in ((this.toProps = {}), this.fromProps)) this.toProps[u] = this.target[u];
                this.duration > 0 || (this.duration = 0),
                    this.ease || (this.ease = r.linear),
                    this.delay > 0 || (this.delay = 0),
                    n && this.setProps(n),
                    (this.time = 0);
            } else console.error("Tween target 为空");
        }
        return (
            (t.prototype.setProps = function (t) {
                for (var e in t) this.target[e] = t[e];
                this.update && this.update(this.target);
            }),
            (t.prototype.clear = function () {
                (this.target = null),
                    (this.fromProps = null),
                    (this.toProps = null),
                    (this.ease = null),
                    (this.complete = null),
                    (this.update = null);
            }),
            (t.prototype.step = function (t) {
                if (this.target instanceof cc.Node && !this.target.isValid) return !0;
                if (this.delay > 0 && (this.delay -= t) > 0) return !1;
                if (this.duration > 0 && (this.time += t) < this.duration) {
                    var e = this.ease(this.time / this.duration);
                    for (var o in this.fromProps)
                        this.target[o] = this.fromProps[o] + (this.toProps[o] - this.fromProps[o]) * e;
                    return this.update && this.update(this.target), !1;
                }
                return this.setProps(this.toProps), this.complete && this.complete(this.target), !0;
            }),
            t
        );
    })();
(function (t) {
    function e(t) {
        return 1 - o(1 - t);
    }
    function o(t) {
        return t < 1 / 2.75
            ? 7.5625 * t * t
            : t < 2 / 2.75
            ? 7.5625 * (t -= 1.5 / 2.75) * t + 0.75
            : t < 2.5 / 2.75
            ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375
            : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
    }
    (t.linear = function (t) {
        return t;
    }),
        (t.quadIn = function (t) {
            return t * t;
        }),
        (t.quadOut = function (t) {
            return 1 - (t = 1 - t) * t;
        }),
        (t.quadInOut = function (t) {
            return t < 0.5 ? t * t * 2 : 1 - (t = 1 - t) * t * 2;
        }),
        (t.cubicIn = function (t) {
            return t * t * t;
        }),
        (t.cubicOut = function (t) {
            return 1 - (t = 1 - t) * t * t;
        }),
        (t.cubicInOut = function (t) {
            return t < 0.5 ? t * t * t * 4 : 1 - (t = 1 - t) * t * t * 4;
        }),
        (t.backIn = function (t) {
            return t * t * (2.7 * t - 1.7);
        }),
        (t.backOut = function (t) {
            return 1 - (t = 1 - t) * t * (2.7 * t - 1.7);
        }),
        (t.backInOut = function (t) {
            return t < 0.5 ? t * t * (1.5 * t - 0.5) * 8 : 1 - (t = 1 - t) * t * (1.5 * t - 0.5) * 8;
        }),
        (t.bounceIn = e),
        (t.bounceOut = o),
        (t.bounceInOut = function (t) {
            return t < 0.5 ? 0.5 * e(2 * t) : 0.5 * o(2 * t - 1) + 0.5;
        });
})((r = o.eases || (o.eases = {})));
